package com.bskms.service.impl;

import com.bskms.mapper.UserMapper;
import com.bskms.model.LoginInfoDo;
import com.bskms.model.MessageRecordDo;
import com.bskms.model.User;
import com.bskms.service.UserAService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * 用户service实现类
 */
@Service
public class UserAServiceImpl implements UserAService {
    @Autowired
    private UserMapper userMapper;


    @Override
    public User validateUserPassword(String name, String password) {
         return userMapper.queryUser(name, password);
    }

    @Override
    public boolean isExistUser(String name) {
        User user = userMapper.queryUserByName(name);
        return user != null;
    }

    @Override
    public void insertUser(String name, String password) {
        userMapper.insertUser(name, password);
    }

    @Override
    public void addUserLoginInfo(LoginInfoDo loginInfoDo) {
        userMapper.addLoginInfo(loginInfoDo);
    }

    @Override
    public void addUserMessageRecord(MessageRecordDo messageRecordDo) {
        userMapper.addMessageRecord(messageRecordDo);
    }

    @Override
    public User getUserByName(String name) {
        return userMapper.getUserByName(name);
    }
}
